﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrderDetail.aspx.cs" Inherits="ZLCMS.Web.SystemManage.Basics.Shop.Order.OrderDetail" %>

<%@ Import Namespace ="ZLCMS.Business.Util" %>
<%@ Import Namespace="ZLCMS.Commands.User.Util" %>
<div class="pageContent">
    <div class="pageFormContent" layoutH="56">
    
    
	<div class="panel collapse">
		<h1>订单管理 </h1>
		<div>
    	<table class="list" width="100%">
    	<tr>
			<td style="width:12%">订单管理：</td>
			<td style="width:88%">
            <table border="0" cellspacing="0" cellpadding="0">
            	<tr>
            		<td width="100px;">
                    <%-- 确认订单--%>
                    <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "CONFIRM") && OrderData.ConfirmedStatus == "0" && OrderData.CancelStatus == "0")
                       {%>
                           <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/Shop/Order/OrderConfirm.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="确认订单"><span>确认订单</span></a>
                <% }else{%>
                      [<%= ParamKit.GetValue("OrderIsConfirmed", OrderData.ConfirmedStatus, "&nbsp;")%>]
                      <%} %>
                   
                </td>
                    <td width="100px;">
                      <%-- 确认支付--%>
                        <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "PAY") && OrderData.CancelStatus == "0" && OrderData.PayStatus == "0" && OrderData.ConfirmedStatus == "1")
                           {%>
                            <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/Shop/Order/OrderPay.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="确认支付"><span>确认支付</span></a>
                          <%}
                           else
                           { %>
                            [<%= ParamKit.GetValue("OrderPayStatus", OrderData.PayStatus, "&nbsp;")%>]
                         <%} %>
                    </td>
                    <td width="100px;">
                   <%-- 确认发货--%>
                       <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "SHIPPING") && OrderData.ShippingStatus == "0" && OrderData.ConfirmedStatus == "1" && OrderData.CancelStatus == "0")
                          {%>
                              <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/Shop/Order/OrderShipping.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="确认发货"><span>确认发货</span></a>
                         <%}
                           else
                           { %>
                            [<%= ParamKit.GetValue("OrderShippingStatus", OrderData.ShippingStatus, "&nbsp;")%>]
                         <%} %>
                    </td>
                    <td width="100px;">
                    <%-- 确认完成--%>
                       <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "FINISH") && OrderData.FinishedStatus == "0" && OrderData.ShippingStatus == "1" && OrderData.CancelStatus == "0")
                          {%>
                         <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/shop/order/OrderFinish.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="完成订单"><span>完成订单</span></a>
                        
                         <%}else
                          {%>
                           [<%= ParamKit.GetValue("OrderIsFinish", OrderData.FinishedStatus, "&nbsp;")%>]
                         <%} %>
                    </td>
                    <td width="100px;">
                    <%-- 确认取消--%>
                     <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "CANCEL") && OrderData.CancelStatus == "0")
                        {%>
                        <a class="button" href="/SystemManage/Basics/shop/order/OrderCancel.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="取消订单"><span>取消订单</span></a>
		            	
                        <%}
                        else
                        {%>
                         [<%= ParamKit.GetValue("OrderIsCancel", OrderData.CancelStatus, "&nbsp;")%>]
                        <%} %>
                    </td>
                <% if (AuthUtil.CheckAuthorization("ORDER_MAN", "EDIT_PRICE") && OrderData.PayStatus != "1" && OrderData.CancelStatus == "0")
                        {%>
                    <td width="100px;">
                    <a style="margin-right: 5px;" class="button" href="/SystemManage/Basics/Shop/Order/ChangePrice.aspx?no=<%= OrderData.OrderNo  %>" target="dialog" rel="orderdlg" max="false" mask="true" maxable="false" minable="false" width="800" height="500" title="修改价格"><span>修改价格</span></a>
                    </td>
                 <%} %>
                </tr>

           </table>
            </td>
        </tr>
    	<tr>
			<td>操作记录：</td>
			<td>
				
        <table class="list" targetType="navTab" asc="asc" desc="desc" style="width: 100%;">
	    <thead>
			<tr>
				<th width="180px">记录时间</th>
				<th>备注</th>
			</tr>
		</thead>
		<tbody>
            <asp:repeater runat="server" id="logs">
                <ItemTemplate>
			    <tr target="uid"><td><%# Eval("RecordDate")%></td>
				    <td><%#  Eval("Memo")%></td>
			    </tr>
                </ItemTemplate>
            </asp:repeater>
            <%if (logs.Items.Count == 0)
              { %>
              <tr><td colspan=2>无记录</td></tr>
            <%} %>
		</tbody>
	</table>
			</td>
	
       </tr>
        </table>
		</div>
	</div>
    
	<div class="panel collapse">
		<h1>订单信息</h1>
		<div>
		
    	<table class="list" width="100%">
        <tr>
            <td style="width: 10%;">订单编号：</td>
            <td style="width: 20%;"><%= OrderData.OrderNo%></td>
			<td style="width: 10%;">交易单号：</td>
			<td style="width: 20%;"><%= OrderData.PaymentNo%></td>
            <td style="width: 10%;">支付凭证号：</td>
            <td style="width: 20%;"><%= OrderData.PaymentTradeNo%></td>
        </tr>
        <tr>
			<td style="width: 10%;">支付方式：</td>
			<td style="width: 20%;"><%= OrderData.PaymentName%></td>
			<td style="width: 10%;">快递单号：</td>
			<td style="width: 20%;">
            <%if (OrderData.ShippingStatus == "1")
              { %>
            <a href='http://www.kuaidi100.com/chaxun?com=<%=OrderData.ShippingType%>&nu=<%=OrderData.ShippingNo%>' target='_blank'><%=OrderData.ShippingNo%></a></td>
            <%}
              else if (OrderData.ShippingStatus == "-9")
              { %>
              暂时不能设置物流信息
            <%}
              else if (OrderData.ShippingStatus == "0")
              {%>未发货
              <%} %>
        </tr>
    	<tr>
			<td style="width: 10%;">订单状态：</td>
			<td colspan='5'>
				    [<%= ParamKit.GetValue("OrderIsConfirmed", OrderData.ConfirmedStatus, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderPayStatus", OrderData.PayStatus, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderShippingStatus", OrderData.ShippingStatus, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderIsFinish", OrderData.FinishedStatus, "&nbsp;")%>]
				    [<%= ParamKit.GetValue("OrderIsCancel", OrderData.CancelStatus, "&nbsp;")%>]
			</td>
	
        </tr>

        </table>
        
        <div class="divider"></div>
        
        <table class="list" targetType="navTab" asc="asc" desc="desc" style="width: 100%;">
	    <thead>
			<tr>
				<th>图片</th>
				<th>商品</th>
				<th>规格</th>
				<th>备注</th>
				<th>数量</th>
				<th>商品价格</th>
				<th>单项小计</th>
			</tr>
		</thead>
		<tbody>
            <asp:repeater runat="server" id="grid">
                <ItemTemplate>
			    <tr target="uid">
				    <td style="width:80px;height:80px"><img style="width:80px;height:80px" src="<%#FileKit.FirstFilePath(Eval("ThumbnailImg")) %>"/></td>
				    <td><%# Eval("ProductSkuNo")%><br /><%#  Eval("ProductName")%></td>
				    <td><%#ZLCMS.Commands.Pub.Util.SkuProductKit.GetSkuItemNames(Eval("SkuParamCode") as string) %></td>
				    <td><%# Eval("Remark")%></td>
				    <td><%# Eval("Counter")%></td>
				    <td><%# Eval("SalePrice")%></td>
				    <td><%# Eval("TotalPrice")%></td>
                    
			    </tr>
                </ItemTemplate>
            </asp:repeater>
            
    	<tr>
			<td colspan="7">
            商品运费：<font color="red">￥<%= OrderData.ShipPrice%></font>&nbsp;&nbsp;
            订单总金额：<font color="red">￥<%= OrderData.TotalPrice%></font>&nbsp;&nbsp;
            需付费用：<font color="red">￥<%= OrderData.PaymentPrice%></font></td>
        </tr>
		</tbody>
	</table>
		</div>
	</div>

	<div class="panel collapse">
		<h1>购货人信息</h1>
		<div>
		
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 8%">姓名：</td>
			<td style="width: 25%"><%= OrderData.MemberName%></td>
			<td style="width: 8%">帐号：</td>
			<td style="width: 25%"><%= OrderData.MemberAccount%></td>
			<td style="width: 8%">联系电话：</td>
			<td style="width: 25%"><%= OrderData.Phone%></td>
        </tr>
        </table>
		</div>
	</div>
    
	<div class="panel collapse">
		<h1>收货人信息</h1>
		<div>
    	<table class="list" width="100%">
    	<tr>
			<td style="width: 8%">收货人姓名：</td>
			<td style="width: 25%"><%= OrderData.ReceiverName %></td>
			<td style="width: 8%">联系电话：</td>
			<td style="width: 25%"><%= OrderData.ReceiverPhone %></td>
        </tr>
    	<tr>
			<td>收货人地址：</td>
			<td><%= OrderData.ReceiverProvince %><%= OrderData.ReceiverCity %><%= OrderData.ReceiverAddress %></td>
			<td>邮政编码：</td>
			<td><%= OrderData.ReceiverPostalCode %></td>
			<td>备注：</td>
			<td><%= OrderData.Remark %></td>
        </tr>
        </table>
		</div>
	</div>
    	
    <div class="panel collapse" style="display:<%=returns.Items.Count == 0?"none":""%>">
		<h1>售后申请信息</h1>
		<div>
    	<table class="list" width="100%">
    	 <thead>
			<tr>
                <th width="80px">商品图片</th>
				<th width="180px">商品名称</th>
                <th width="120px">理由</th>
                <th width="80px">相关图片</th>
                <th width="120px">状态</th>
				<th width="180px">处理进度</th>
                <th width="20px">操作</th>
			</tr>
		</thead>
		<tbody>
          <asp:repeater runat="server" id="returns"  OnItemDataBound="returns_ItemDataBound">
                <ItemTemplate>
			    <tr target="uid">
				    <td style="width:80px;height:80px"><img style="width:80px;height:80px" src="<%#FileKit.FirstFilePath(((IDictionary)Container.DataItem)["ProductImage"]) %>"/></td>
				    <td><%#  ((IDictionary)Container.DataItem)["ProductName"]%><%#ZLCMS.Commands.Pub.Util.SkuProductKit.GetSkuItemNames(((IDictionary)Container.DataItem)["ProductSkuData"] as string)%></td>
                    <td>
                    [<%#  ParamKit.GetValue("OrderReturnType", ((IDictionary)Container.DataItem)["ReturnType"], "&nbsp;")%>]
                    </td>
                    <td class="images">

                    <%#GetImageHtml(((IDictionary)Container.DataItem)["ThumbnailImg"] as string)%>
                
                    </td>
                    <td>
                    <table class="list" targetType="navTab" asc="asc" desc="desc" style="width: 100%;">
                            <tr>   <td>[<%# ParamKit.GetValue("OrderIsConfirmed", ((IDictionary)Container.DataItem)["ConfirmStatus"], "&nbsp;")%>] </td>   
                             <td>[<%# ParamKit.GetValue("ProcessStatus", ((IDictionary)Container.DataItem)["ProcessStatus"], "&nbsp;")%>]    </td></tr>
				            <tr>     <td>[<%# ParamKit.GetValue("OrderIsFinish", ((IDictionary)Container.DataItem)["FinishStatus"], "&nbsp;")%>]     </td>     
                            <td>[<%# ParamKit.GetValue("OrderIsCancel", ((IDictionary)Container.DataItem)["CancelStatus"], "&nbsp;")%>]     </td></tr>
                    </table>
                    </td>
				    <td>
                     <table class="list" targetType="navTab" asc="asc" desc="desc" style="width: 100%;">
		                    <tbody>
                      <asp:repeater runat="server" id="logs">
                        <ItemTemplate>
			                <tr target="uid">
                            <td width="100px;">
                            <%#  ((IDictionary)Container.DataItem)["RecordDate"]%>
                            </td>
				             <td width="100px;">
                            <%#  ((IDictionary)Container.DataItem)["OptAccount"]%>  <%#  ((IDictionary)Container.DataItem)["Memos"]%>
                             </td>
			                </tr>
                        </ItemTemplate>
                      </asp:repeater>
		</tbody>
	</table>

                    </td>
                    <td>  <a href="/SystemManage/Basics/Shop/OrderReturns/OrderReturnsDetail.aspx?id= <%#((IDictionary)Container.DataItem)["Id"]%>&freshtabid=<%= _framePage.NavTabId %>" target="navTab" title="售后详情" rel="OrderReturnsDetail">查看</a></td>
			    </tr>
                </ItemTemplate>
            </asp:repeater>
                        <%if (returns.Items.Count == 0)
              { %>
              <tr><td colspan=2>无记录</td></tr>
            <%} %>
		</tbody>
        </table>
		</div>
	</div>
    	
    <div class="panel collapse" style="display:<%=refund.Items.Count == 0?"none":""%>">
		<h1>退款信息</h1>
		<div>
    	<table class="list" width="100%">
    	 <thead>
			<tr>
                <th width="80px">商品图片</th>
				<th width="200px">商品名称</th>
                <th width="50px" >购买数量</th>
                <th width="80px">实际支付</th>
                <th width="80px">退款金额</th>
                <th width="200px">备注</th>
                <th width="200px">状态</th>
				
                <th width="30px">操作</th>
			</tr>
		</thead>
		<tbody>
          <asp:repeater runat="server" id="refund" >
                <ItemTemplate>
			    <tr target="uid">
                <td style="width:80px;height:80px"><img style="width:80px;height:80px" src="<%#FileKit.FirstFilePath(((IDictionary)Container.DataItem)["ThumbnailImg"]) %>"/></td>
				    <td><%#  ((IDictionary)Container.DataItem)["ProductName"]%></td>
                    <td>
                    <%# ((IDictionary)Container.DataItem)["Quantity"]%>
                    </td>
                     <td>

                    <%#((IDictionary)Container.DataItem)["PaymentPrice"]%>
                
                    </td>
                    <td>

                    <%#((IDictionary)Container.DataItem)["RefundPrice"]%>
                
                    </td>
                     <td>

                    <%#((IDictionary)Container.DataItem)["Memos"]%>
                
                    </td>
                    <td>
                    <table class="list" targetType="navTab" asc="asc" desc="desc" style="width: 100%;">
                          <tr>
                            <td><%# ((IDictionary)Container.DataItem)["ConfirmDate"] %> [<%# ParamKit.GetValue("OrderIsConfirmed", ((IDictionary)Container.DataItem)["ConfirmStatus"], "&nbsp;")%>] </td>   
                           </tr>
                           <tr>
                           <td><%# ((IDictionary)Container.DataItem)["ProcessDate"] %> [<%# ParamKit.GetValue("ProcessStatus", ((IDictionary)Container.DataItem)["ProcessStatus"], "&nbsp;")%>]    </td>
                          </tr>
				          <tr>
                            <td><%# ((IDictionary)Container.DataItem)["FinishDate"] %> [<%# ParamKit.GetValue("OrderIsFinish", ((IDictionary)Container.DataItem)["FinishStatus"], "&nbsp;")%>]     </td>     
                          </tr>
                          <tr>
                           <td><%# ((IDictionary)Container.DataItem)["CancelDate"] %> [<%# ParamKit.GetValue("OrderIsCancel", ((IDictionary)Container.DataItem)["CancelStatus"], "&nbsp;")%>]     </td>
                          </tr>
                    </table>
                    </td>
				   
                    <td>  <a href="/SystemManage/Basics/Shop/OrderReturns/OrderRefundDetail.aspx?rno= <%#((IDictionary)Container.DataItem)["RefundNo"]%>&freshtabid=<%= _framePage.NavTabId %>" target="navTab" title="退款详情" rel="OrderRefundDetail">查看</a></td>
			    </tr>
                </ItemTemplate>
            </asp:repeater>

            <%if (refund.Items.Count == 0)
              { %>
              <tr><td colspan=2>无记录</td></tr>
            <%} %>
		</tbody>
        </table>
		</div>
	</div>


	</div>
        
	<div class="formBar">
		<ul>
			<li><div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div></li>
		</ul>
	</div>  
</div>
<script type="text/javascript">
    $('td.images').find('.prettyPhoto').prettyPhoto();
</script>
